.TH std::atan(std::complex) 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::atan(std::complex) \- std::atan(std::complex)

.SH Synopsis
   Defined in header <complex>
   template< class T >                      \fI(since C++11)\fP
   complex<T> atan( const complex<T>& z );

   Computes complex arc tangent of a complex value z. Branch cut exists outside the
   interval [−i, +i] along the imaginary axis.

.SH Parameters

   z - complex value

.SH Return value

   If no errors occur, complex arc tangent of z is returned, in the range of a strip
   unbounded along the imaginary axis and in the interval [−π/2, +π/2] along the real
   axis.

   Errors and special cases are handled as if the operation is implemented by -i
   * std::atanh(i * z), where i is the imaginary unit.

.SH Notes

   Inverse tangent (or arc tangent) is a multivalued function and requires a branch cut
   on the complex plane. The branch cut is conventionally placed at the line segments
   (-∞i,-i) and (+i,+∞i) of the imaginary axis.

   The mathematical definition of the principal value of inverse tangent is atan z = -

   1
   2

   i [ln(1 - iz) - ln (1 + iz)].

.SH Example


// Run this code

 #include <cmath>
 #include <complex>
 #include <iostream>

 int main()
 {
     std::cout << std::fixed;
     std::complex<double> z1(0.0, 2.0);
     std::cout << "atan" << z1 << " = " << std::atan(z1) << '\\n';

     std::complex<double> z2(-0.0, 2.0);
     std::cout << "atan" << z2 << " (the other side of the cut) = "
               << std::atan(z2) << '\\n';

     std::complex<double> z3(0.0, INFINITY);
     std::cout << "2 * atan" << z3 << " = " << 2.0 * std::atan(z3) << '\\n';
 }

.SH Output:

 atan(0.000000,2.000000) = (1.570796,0.549306)
 atan(-0.000000,2.000000) (the other side of the cut) = (-1.570796,0.549306)
 2 * atan(0.000000,inf) = (3.141593,0.000000)

.SH See also

   asin(std::complex)  computes arc sine of a complex number
   \fI(C++11)\fP             (\\({\\small\\arcsin{z}}\\)arcsin(z))
                       \fI(function template)\fP
   acos(std::complex)  computes arc cosine of a complex number
   \fI(C++11)\fP             (\\({\\small\\arccos{z}}\\)arccos(z))
                       \fI(function template)\fP
   tan(std::complex)   computes tangent of a complex number (\\({\\small\\tan{z}}\\)tan(z))
                       \fI(function template)\fP
   atan
   atanf               computes arc tangent (\\({\\small\\arctan{x}}\\)arctan(x))
   atanl               \fI(function)\fP
   \fI(C++11)\fP
   \fI(C++11)\fP
   atan(std::valarray) applies the function std::atan to each element of valarray
                       \fI(function template)\fP
   C documentation for
   catan
